home *** CD-ROM | disk | FTP | other *** search
- +-------------------------------------------+
- | N6NKF Real Time Spectrum Analyzer Program |
- | Version 0.97 06/19/88 |
- | Copyright (c) Franklin Antonio, 1988 |
- +-------------------------------------------+
-
- Required Hardware/Software...
- Computer: Any IBM PC/XT/AT/PS2 or clone
- Memory: At least 256k memory
- Graphics: CGA or EGA or VGA graphics board
- System: DOS 2.0 or newer, or OS/2 1.0
- Signal Source: A signal source is required, which can be any one of
- the following...
- a. A binary disk file of integer data samples
- b. A formatted disk file of real data samples
- c. A/D converter on a Dalanco/Spry Model 10 board
- d. Any A/D converter, with a user-written driver.
-
- Recommended Optional Hardware..
- An EGA or VGA graphics board is especially recommended.
- Microsoft mouse, or Mouse-Systems Corp. mouse, or compatible.
-
- Things that are NOT required...
- Coprocessor: 8087 or 80287 numeric co-processor is NOT required, but
- will be used if present.
- DSP Processor: A DSP board is NOT required.
- ANSI.SYS: This program does NOT require ANSI.SYS
-
- Copyright Statement...
- Copyright (c) Franklin Antonio, 1988. All Rights Reserved.
- This program is provided at no cost for amateur non-profit use
- only. Non-profit distribution of the unmodified program and
- documentation is allowed. Commercial use or distribution of
- this program is prohibited unless license has been obtained
- from the author. Copyright is claimed on both the program and
- the visual images the program generates.
-
-
-
-
- The remainder of this document consists of the following sections...
-
- 0. Getting Started
- 1. Commands
- 2. Command line options
- 3. NKFSA.INI file options
- 4. Speed of Execution
- 5. Notes re Dalanco-Spry board
- 6. Notes re using file signal source
- 7. Characteristics with various display adapters
- 8. Limitations
- 9. Testing, Bugs, Etc.
- 10. Bibliography
-
-
-
-
- Getting Started...
- ------------------
-
- If you are not already familiar with use of a spectrum analyzer, some of the
- controls may seem quite alien. To gain familiarity with the effect of
- windowing, averaging, resolution, etc controls, I suggest you fire up the
- program using the internally generated "demo" signal source. This signal
- consists of a sum of five sinusoids at different amplitudes and frequencies.
- One is frequency modulated, and one is amplitude modulated. To start NKFSA
- with the demo signal source, give the command..
-
- > NKFSA -sd
-
- The program will begin set for highest resolution, and a Blackman window.
- You may now alter any control settings using either the mouse or keyboard.
-
-
-
-
- Commands...
- -----------
-
- HELP:
- Type ? or click mouse on "HELP" for on-screen help display.
- In some cases, the on-screen help contains additional information.
-
- Source:
- Change by clicking mouse on "Sig Src", or type "s". This selects the
- source of the signal to be analyzed. Present options are...
-
- 1. Demo (a dummy signal provided for demo)
- 2. A/D on Dalanco/Spry Model 10 board
- 3. Binary 16-bit Integer Disk file
- 4. Formatted Real Disk File
- 5. User-written A/D converter driver
-
- As shipped, the Demo signal is the default signal source, because
- that's the only signal source i'm sure everybody has.
-
- Signal source may also be specified on the command line, and the
- default signal source may be specified in the NKFSA.INI file. See
- descriptions of these below.
-
- More info about #2, #3, and #4 above can be found toward the end of
- this document and in the online help screens. More info about #5 can
- be found in the file NKFDRV.DOC.
-
-
- Function:
- Change by clicking mouse on "Function", or typing "f".
- This selects the function to be computed & displayed. Present options
- are "Waveform" (ie like an oscilloscope), "Spectrum" (like a spectrum
- analyzer), and "Cepstrum". This program is basically a spectrum anal-
- izer. The waveform display was added as an afterthought, and is not
- elaborate.
-
- Frequency Resolution:
- Change by clicking the mouse on "Frq Res" or type "r".
- This selects the transform size, from 1024 pts to 64 pts, which
- at 6kHz sample rate corresponds to 5.8 Hz to 93.8 Hz resolution.
- This corresponds to the resolution bandwidth knob on an analog
- spectrum analyzer.
-
- Wdw:
- Select the spectral window by clicking on "Wdw:", or typing "w".
- This selects among three fairly standard windows...
-
- Rectangular -- Maximum detectability. -13 db first sidelobe
- Hamming -- Compromise. -43 db first sidelobe
- Exact Blackman -- Lowest Leakage -68 db first sidelobe
-
- If you are not familiar with the effect of windowing, then you may
- wish to leave this control set on "Blk" (the Exact Blackman window,
- which is the default. There is no corresponding knob on an analog
- spectrum analyzer.
-
- Avg:
- Selects the # of periodograms which are averaged prior to display.
- Click on "Avg", or type "a". Options are "off" and "x3". Averaging
- increases the stability of a spectral estimate, but may blur rapidly
- changing spectra. This corresponds to the video averaging control on
- an analog spectrum analyzer.
-
- Hld:
- Turns the "max hold" feature on and off. When this switch is on, the
- program remembers the maximum value of the spectrum at each frequency,
- and displays the maximum in a different color. (only available on EGA
- or VGA displays.)
-
- scL:
- Sets the vertical display scale. In this version, 10db/division
- logrithmic display is the only option.
-
- Grat:
- Selects which graticule appears behind the spectrum. Choices are none,
- dot, line, and grid. On CGA displays, there is no graticule.
-
- EXITing:
- Click on "EXIT", or type "e", or the F10 key. This corresponds to the
- off switch on an analog spectrum analyzer.
-
- Annotation:
- Press the mouse button while the mouse cursor is in the spectrum
- display area, and the frequency and amplitude at that point will be
- displayed. I've used the standard mouse cursor, which has it's hot-
- spot located three pixels to the left and one above the mouse tip.
-
- PrtSc:
- Typing the PrtSc key (not Shift-PrtSc) at any time will produce a
- screen dump to printer. Epson-like printer command set assumed, and
- normal DOS printer redirection in effect. This built-in screen dump
- does not prevent you from using your own screen dump TSR. See next
- paragraph.
-
- Typing Shift-PrtSc will, as usual, invoke the default DOS print screen
- function, which is not graphics capable, unless you have installed a
- TSR for this purpose.
-
-
-
-
- Command Line Options...
- -----------------------
-
- You may specify any one of the following options on the command line when you
- invoke this program. Options are case sensitive, so must be typed in lowercase
- as shown..
-
- -su Set signal source to "user-supplied driver"
- -sf{f} Set signal source to 16-bit integer binary disk file {f}
- -sg{f} Set signal source to real formatted data file {f}
- -s3 Set signal source to "Dalanco-Spry"
- -sd Set signal source to "Demo"
-
- -wr Set window to "rectangular"
- -wh Set window to "Hamming"
- -wb Set window to "Blackman"
-
- -sr{n} Set sample-rate to n samples per second.
-
- -dc Force use of CGA display mode.
- Normally, this program attempts to automatically use an EGA if
- available, otherwise it uses CGA. -dc forces the display to
- use CGA mode. I use this for debugging the CGA mode.
-
- Example command line with lots of options...
-
- > nkfsa -dc -sfa:\dir\file.dat -sr6000 -wh
-
-
-
-
- NKFSA.INI file options...
- -------------------------
-
- Each time NKFSA runs, it reads a parameter file, NKFSA.INI. NKFSA searches
- first in the local directory. If there is no NKFSA.INI file in the local
- directory, the top level directory on the current drive is searched. Commands
- in this file specify the colors NKFSA uses (on EGA or VGA displays), and
- default values for many of the parameter settings described above.
-
- Documentation on commands in the .INI file is contained in comments in the file
- itself.
-
-
-
-
- Speed of Execution...
- ---------------------
- There is a commonly held belief that you can't do real-time signal processing
- without using special DSP chips. It isn't true!
-
- At it's highest resolution setting, NKFSA computes one spectral estimate in
- about 140 ms (for any integer data source, i.e. any except the "formatted real
- data file")...
-
- times on standard 8 MHz IBM-AT are...
- 1024 sample Windowing+FFT = 109 ms
- 512 frequency Power+Averaging+Logrithm = 19 ms
- 512 frequency display on CGA/EGA/VGA = 11 ms
- -------
- Total = 139 ms
-
- Max hold display, when enabled, adds another 10 ms.
-
- Assuming a sample rate of 6kHz, 1024 samples = 171 ms, so this does run in
- REAL-TIME, examining 100% of the data, for a < 3kHz (voice) bandwidth. This
- example is for the highest resolution (1024 pts). At lower resolution
- settings, of course, it goes faster!
-
- When running on a slower machine such as an 8088-based PC or XT, the program
- will obviously run more slowly. Much of the speed can be regained, however,
- by reducing the resolution setting (Frq Res).
-
- Examining 100% of the data may seem "only reasonable" (It does to me.), but
- this is an amazingly larger portion of the signal than would be processed by a
- traditional analog spectrum analyzer with similar settings on its controls.
-
- To put this in perspective, consider how a traditional analog spectrum
- analyzer works. It estimates the spectum by sweeping a single filter across
- the band of interest. To be comparable to the NKFSA settings described above,
- our example analog spectrum analyzer would be sweeping a 5.9 Hz wide filter
- over the range [0 Hz, 3 kHz]. This filter can only be in one place at a time,
- and that 3 kHz range is 512 times wider than the 5.9 Hz wide analysis filter.
- This means that this single analysis filter spends roughly 1/512th of it's time
- at any particular frequency. This means that at each frequency, the filter is
- only able to examine about 1/512th of the input data!
-
- Using Fast-Fourier-Transform techniques, digital spectrum analyzers, such as
- NKFSA, compute the output of a large number of filters simultaniously. In the
- example above, with 1024 input points, NKFSA would be computing 512 analysis
- filters in parallel, every 140ms. Using 512 filters in parallel, a filter at
- each frequency is able to examine all the input data, all of the time.
-
- What about sample rates significantly greater than 6kHz? NKFSA can deal with
- these too, although the computation can no longer examine 100% of the data that
- flys by. In particular, I have used NKFSA with my Dalanco/Spry board at 80kHz
- sample rate, which is the maximum sample rate that boards supports. As
- described above, NKFSA takes about 140 ms to compute & display one spectral
- estimate based on 1024 points of input. At 80kHz, 11,200 samples will fly by
- in that 140ms. This means NKFSA can examine 1024 out of every approx 11,200
- samples. That's 1/11th of the data. Still 46 times better than the analog
- spectrum analyzer!
-
-
-
-
- Notes re Dalanco-Spry Model 10 Board..
- --------------------------------------
-
- The driver for the D/S board assumes that D/S shared memory is mapped to D000H,
- D/S i/o is mapped to 300H, jumper JA is in the "lower" position, and jumper J5
- is in the "ext" position.
-
- NKFSA loads the appropriate software into the D/S board & sets the sample rate.
- You don't have to run any ancillary programs.
-
- The D/S board is used only for it's A/D converter. All calculations are done
- in the PC.
-
- The author has no affiliation with Dalanco/Spry. Someone gave me one of their
- boards, so it seemed convenient to write a driver.
-
-
-
-
- Notes re Using the "Integer Disk File" Signal Source
- ----------------------------------------------------
-
- NKFSA assumes that the disk file you specify is a binary file that contains a
- stream of 16-bit numbers, and nothing else (no formatting, record marks, etc).
- Each of these 16-bit numbers should be an ordinary 2's-complement number in
- the range [-8192,+8191]. If you write one of these files in a FORTRAN program,
- be sure to specify FORM='BINARY' in the open statement.
-
- If the disk file is longer than NKFSA's spectral analysis window, NKFSA will
- read thru the file, (like a movie) crunching on blocks of samples in a fashion
- similar to the way it operates on samples in real-time. When it hits the end-
- of-file, it repeats. If the disk file is shorter than the analysis window,
- NKFSA pads the window with zeros, and processes it as usual.
-
-
-
-
- Notes on Using the "Real Disk File" Source:
- ------------------------------------------
-
- The "Real Disk File" source reads a formatted file of numbers in an "e" or "f"
- type format (ie like nnn.nnnnnn or nnn.nnnEnnn), one number per line. If the
- file is shorter than the analysis window, the window is padded with zeros.
- The analysis is done in floating-point arithmetic, and the results are auto-
- matically scaled so that the highest point in the spectrum appears at a fixed
- point on the screen.
-
- This mode was specifically included to evaluate the frequency characteristics
- of FIR filters. Some versions of the McLellen-Parks FIR filter design program
- produce a formatted output file containing the impulse response of the designed
- filter in a format as described above. <<The widely distributed version from
- the old IEEE distribution tape, does not generate such a file. I have included
- the program MACPARK.EXE with this distribution. This is an updated McLellen-
- Parks from the book "Digital Filter Design" by Parks & Burrus. It has an inter-
- active input section which is much easier to use, and it generates an output
- file of impulse response data. If you need documentation for using MACPARK,
- please buy a copy of Parks & Burrus' excellent book.>> When the input signal
- has a natural beginning and end within the analysis window, as an FIR filter
- impulse response does, you should always use a rectangular analysis window.
-
- I have also included a file FIR.DAT which contains an example FIR bandpass
- filter impulse response. To view the corresponding frequency response...
-
- > NKFSA -sgFIR.DAT -wr
-
- You may also specify a sample rate on the command line, using the -sr option.
- This will make the frequency annotation units on the screen agree with your
- intended use of the filter.
-
- Also included in the distribution is the file SUNSPOT.DAT. This file contains
- 184 years of January mean sunspot numbers. The sample rate is 1 sample/year.
- Because NKFSA doesn't understand sample rates that low, you have to lie. Tell
- it the sample rate is 1000 samples/second. Then, scale the resulting anno-
- tation in your head. For example, 500Hz --> 0.5 cycles/year, 100Hz --> 0.1
- cycles/year. The highest point in the spectrum appears at approximately
- 90Hz --> 0.090 cycles/year, and is known as the 11 year sunspot cycle.
-
- > NKFSA -sgSUNSPOT.DAT -sr1000
-
- Processing real input is much slower than any other calculation done by NKFSA,
- because it's the only calculation done in floating-point arithmetic. A 1024
- point calculation takes about 2.5 seconds on an AT w/287, about 3 seconds on a
- PC w/8087.
-
-
-
-
- Characteristics with Various Display Adapters:
- ----------------------------------------------
-
- There are unfortunately a great many different display adapters on IBMPC
- systems. This program is designed to work with many of them. A brief summary
- of what this program supports follows..
-
- EGA = Enhanced Graphics Adapter
- The EGA is the lowest-cost adapter that allows full functionality
- of NKFSA. I run this adapter in the 16-color 640x350 graphics mode.
- User can choose which colors NKFSA uses, by specifying them in the
- NKFSA.INI file.
-
- VGA = Video Graphics Array (also known as IBM PS/2 Display Adapter)
- I run this adapter in the 16-color 640x350 graphics mode.
- Everything works identical to EGA at the present time. I am
- considering adding new features to NKFSA which will only be
- accessible to users with VGA cards however.
-
- CGA = Color Display Adapter
- I run this adapter in the black & white 640x200 graphics mode.
- Everything is supported on CGA, except that only one spectrum or
- waveform can be displayed in the central window. (ie the graticule
- and the max-hold feature are invisible). Of course, the program
- loses much of it's pizzaz when viewed in black & white, but it is
- functional.
-
- HGC = Hercules Graphics Card
- I intend to support HGC in a later version of this program.
- It's about half done now. Should also work on HGC+. Everything will
- be supported except the max-hold feature. I will run this adapter in
- its 720x348 black & white graphics mode, so it will have resolution as
- good as the EGA, but no color. Meanwhile, Joe Mack, NA3T, has reported
- that he uses NKFSA successfully on a PC with HGC by running a CGA->HGC
- conversion utility called HGCIBM. He reports that this slows NKFSA by
- a factor of 2.
-
- HCC = Hercules Color Card
- This card is a clone of the CGA, so should work just like CGA, but
- has not been tested.
-
- MDA = Monochrome Display Adapter
- This display adapter doesn't support graphics, so we can't use it
- to display spectra. If you have two display adapters on your system,
- either MDA+CGA, or MDA+EGA, or MDA+VGA, that's ok. If you do have a
- two display system, you may fire up NKFSA when either display is
- current. If the MDA is the current display when you run NKFSA, it
- will leave the spectrum analyzer picture on the CGA/EGA/VGA when it
- exits.
-
- XXX = Any other display adapter
- I don't know. I haven't tried it.
-
-
-
-
- Limitations:
- ------------
-
- Probably not presently very compatible with DoubleDOS, TopView, or DesqView,
- or other multi-processing utilities. No attempt is made to do any special
- programming to be DD or TV or DV friendly.
-
- Appears to run ok under OS/2 1.0, in the DOS-compatibility window.
-
- Has been tested under DoubleDOS 4.0, and worked ok in two-screen mode, (ie
- DISPLAY=BOTH command in ddconfig.sys file) *IF* i did not load a mouse driver.
- If I do load the mouse driver under DoubleDOS, the mouse cursor eats characters
- on the display. The official response from SoftLogic was...
- Msg # 4509 Dated 06-17-88 10:56:34
- From: SYSOP
- To: FRANKLIN ANTONIO
- Re: (R)MICE VS DDOS
-
- Franklin, unfortunately I can offer no other suggestions. I think this
- is about as good as you are going to get running a mouse under
- DoubleDOS. jack-sysop
-
- I have not tried TopView or DesqView.
-
- Command line arguments require at least DOS 3.0 or newer. All other features
- should work under any version of DOS.
-
-
-
-
- Testing, Bugs, Etc:
- -------------------
-
- I have tried to test this program to a reasonable degree. Unfortunately,
- users have a variety of hardware and software environments, and this provides
- an incredible testing challenge. With the aid of Paul Williamson, KB5MU,
- Tom Lafleur, KA6IQA, & Mike Brock, WB6HHV, this program has been tested on..
-
- Computers: A real IBM-AT with 287, a real IBM-7552 "industrial
- computer" without 287, a COMPAQ-386 with 287, a 'turbo'
- XT clone with an NEC V20 CPU with 8087, a 'turbo' XT clone
- with 8088 CPU without 8087, an Atega 386 with 287.
-
- Display Adapters: A real IBM CGA, a real IBM EGA, a Quadram EGA clone,
- a Vega VGA+ clone, an ATI VGA clone.
-
- Mice: A Microsoft serial mouse using MOUSE.COM 6.11 driver, a
- Microsoft bus mouse using MOUSE.COM 6.13, a Mouse-Systems
- serial mouse using MSMOUSE.COM 5.03 driver.
-
- System: DOS 3.1, 3.2, 3.3 and the DOS-compatibility window of OS/2 1.0
-
- Your environment will undoubtedly be different. Comments are welcome. My
- address can be found in the online help text.
-
-
- Known problems:
- 1. One user has complained of a "lost mouse clicks" problem.
-
- 2. If certain errors occur while processing (problems with the signal
- source, for example) NKFSA displays a message on the screen which
- contains the statement "type any character to continue". If this
- is a hard error (you forgot to load the TSR A/D driver, or you're
- having trouble reading a disk file, etc) then the error message
- will reappear after you type that character (because NKFSA will
- trying again to read the same signal source). You can break out of
- this loop by typing the F10 key twice in rapid succession.
-
-
-
-
- Bibliography
- ------------
-
- Technical information on spectrum analysis (from a digital computation point
- of view) can be found in...
-
- R.B.Blackman & J.W.Tukey, The Measurement of Power Spectra,
- Dover Publications, New York, 1958.
- SBN (Paperback edition) = 486-60507-8
-
- A.V.Oppenheim & R.W.Schafer, Digital Signal Processing,
- Prentice-Hall, New Jersey, 1975
- ISBN = 0-13-214635-5
- (chapter 11 -- Power Spectrum Estimation)
-
- S.M.Kay & S.L.Marple, "Spectrum Analysis -- A Modern Perspective",
- Proceedings of the IEEE, V69, #11, Nov. 1981, pp 1380-1419,
- (contains a bibliography with 278 entries!)
-
- C.S.Burrus & T.W.Parks, DFT/FFT and Convolution Algorithms,
- John Wiley & Sons, 1985,
- ISBN 0-471-81932-8
-